|
|
|
@@ -109,3 +109,24 @@ module Agents
|
|
109
|
109
|
end
|
|
110
|
110
|
|
|
111
|
111
|
end
|
|
|
112
|
+
|
|
|
113
|
+# Clock that cannot be set and represents monotonic time since
|
|
|
114
|
+ # some unspecified starting point.
|
|
|
115
|
+ #
|
|
|
116
|
+ # @!visibility private
|
|
|
117
|
+ GLOBAL_MONOTONIC_CLOCK = class_definition.new
|
|
|
118
|
+ private_constant :GLOBAL_MONOTONIC_CLOCK
|
|
|
119
|
+
|
|
|
120
|
+ # @!macro [attach] monotonic_get_time
|
|
|
121
|
+ #
|
|
|
122
|
+ # Returns the current time a tracked by the application monotonic clock.
|
|
|
123
|
+ #
|
|
|
124
|
+ # @return [Float] The current monotonic time when `since` not given else
|
|
|
125
|
+ # the elapsed monotonic time between `since` and the current time
|
|
|
126
|
+ #
|
|
|
127
|
+ # @!macro monotonic_clock_warning
|
|
|
128
|
+ def monotonic_time
|
|
|
129
|
+ GLOBAL_MONOTONIC_CLOCK.get_time
|
|
|
130
|
+ end
|
|
|
131
|
+
|
|
|
132
|
+ module_function :monotonic_time
|